package io.github.maojian.dynamicprogramming;

import org.junit.Test;

/**
 * @Auther: jian.mao
 * @Date: 2022-06-22 13:42
 * @Description: https://leetcode.cn/problems/climbing-stairs/
 */
public class Q70 {
    public int climbStairs(int n) {
        if (n <= 2) return n;
        int temp, first = 1, second = 2;
        for (int i = 3; i <= n; i++) {
            temp = first + second;
            first = second;
            second = temp;
        }
        return second;
    }

    @Test
    public void test() {
        System.out.println(climbStairs(3));
    }
}
